package hw;

import sk.Listen;
import sk.Util;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LoginPanel extends JPanel implements ActionListener {
    private ATM atm;
    private JButton loginBtn;
    private Icon loginImg = Util.getImageIcon("/images/buttonLand.jpg");

    public LoginPanel(ATM atm) {
        this.atm = atm;
        this.setLayout(null);
        this.setOpaque(false);

        loginBtn = new JButton(loginImg);
        loginBtn.setBounds(10, 40, 140, 50);
        this.add(loginBtn);
        loginBtn.addActionListener(this);
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == loginBtn) {
            atm.switchPanel("menu");
        }
    }
}
